const shopInfo = wx.getStorageSync('shopInfo')
Component({
  properties: {
    showMakePhone: {
      type: Boolean,
      value: false
    },
    showKefu: {
      type: Boolean,
      value: true
    },
    shopInfo: {
      type: null,
      value: null,
      observer(shopInfo) {
        if(shopInfo){
          this.setData({
            customerServiceInfo: {
              servicePhone: shopInfo.Address.PhoneNumber,
              serviceTimeDuration: shopInfo.OpeningHours
            }
          })
        }
      },
    }
  },
  data: {
    customerServiceInfo: {
      servicePhone: shopInfo?shopInfo.Address.PhoneNumber:'',
      serviceTimeDuration: shopInfo?shopInfo.OpeningHours:'',
    }
  },
  methods: {
    closeMakePhone: function () {
      this.triggerEvent('closeMakePhone', {
        showMakePhone: false,
      });
    },

    call: function () {
      wx.makePhoneCall({
        phoneNumber: this.data.customerServiceInfo.servicePhone,
      });
    }
  }
});